<!DOCTYPE html>
<html lang="en"xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="multipart/form-data; charset=utf-8" />
    <title>首页</title>
    <script  src="../../static/layui/layui.js" data-th-src="@{/layui/layui.js}"></script>
    <link rel="stylesheet"  data-th-href="@{/layui/css/layui.css}" href="../../static/layui/css/layui.css" >
    <style>

        .layui-breadcrumb{
            line-height: 30px;
        }
    </style>
</head>
<body>
<form  method="post" class="layui-form" data-th-action="@{/insertLines/insert}" enctype="multipart/form-data">
    <div class="layui-form-item">
        <label class="layui-form-label">大学名称：</label>
        <div class="layui-input-inline">
            <input type="text" name="coName" id="coName" required  lay-verify="required" placeholder="请输入大学名称" autocomplete="off" class="layui-input">
        </div>
        <div id="u1" style="display: inline"></div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">学科</label>
        <div class="layui-input-block">
            <input type="radio" name="frType" value="0" title="文科">
            <input type="radio" name="frType" value="1" title="理科" checked>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">录取分数线:</label>
        <div class="layui-input-block">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">2015年：</label>
        <div class="layui-input-inline">
            <input type="text" name="2015" required  lay-verify="required" placeholder="请输入录取线" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">2016年：</label>
        <div class="layui-input-inline">
            <input type="text" name="2016" required  lay-verify="required" placeholder="请输入录取线" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">2017年：</label>
        <div class="layui-input-inline">
            <input type="text" name="2017" required  lay-verify="required" placeholder="请输入录取线" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">2018年：</label>
        <div class="layui-input-inline">
            <input type="text" name="2018" required  lay-verify="required" placeholder="请输入录取线" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">2019年：</label>
        <div class="layui-input-inline">
            <input type="text" name="2019" required  lay-verify="required" placeholder="请输入录取线" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script data-th-inline="javascript">
    //Demo
    layui.use(['form','jquery'], function(){
        let {form,$} = layui;

    });
</script>

<script type="text/javascript" data-th-src="@{/js/jquery-3.5.1.js}" src="../../static/js/jquery-3.5.1.js"></script>

<script type="text/javascript">
    $("#coName").blur(function() {
        exitphone();
    });

    function exitphone() {
        var coName = document.getElementById("coName");
        var coNameValue = coName.value;
        alert(coNameValue);
        if(coNameValue ==""){
            document.getElementById("u1").innerHTML = "<font color='red' >请输入学校名称</font>";
            return;
        }
        $.ajax({
            type:'GET',
            url:"/insertLines/inquireSchool/"+coNameValue,
            success: function (data) {
                let msg =data[0].msg;
                let type1=data[0].type;
                alert(msg);
                if(type1 == 0){
                    document.getElementById("u1").innerHTML = "<font color='red' >"+msg+"</font>";
                }else{
                    document.getElementById("u1").innerHTML = "<font color='green' >"+msg+"</font>";
                }
            },
            dataType: 'json',
        });
    }
</script>
</body>
</html>